package code.structure.module.friends
{
	import com.patience.mvc.context.Command;
	
	import flash.events.Event;
	
	import code.main.App;
	import code.main.AppCommonView;
	import code.main.core.mvc.YController;
	import code.structure.module.friends.view.FriendsView;
	import code.untils.CommandNameConst;
	
	/**
	 *好友控制器
	 * @author CYoung
	 * 2014-7-15下午9:52:32
	 */
	public class FriendsController extends YController
	{
		private var _friendsView:FriendsView;
		private var _friendsModel:FriendsModel;
		
		public function FriendsController()
		{
			super();
		}
		/**
		 * 启动好友模块
		 */		
		override public function start():void
		{
			_friendsModel = new FriendsModel();
			
			_friendsView = new FriendsView(this);
			(_context.commonView as AppCommonView).appContainer.uiLayer.addChild(_friendsView);
			setViewPoint(null);
			App.appstage.addEventListener(Event.RESIZE, setViewPoint);
			
			register(CommandNameConst.COMMAND_READ_FRIENDSLIST, handleCommand);
		}
		
		private function setViewPoint(e:* = null):void{
			_friendsView.x = App.appstage.stageWidth >> 1;
			_friendsView.y = App.appstage.stageHeight;
		}
		private function handleCommand(c:Command):void
		{
			trace("读取好友列表完成 开始显示好友")
		}
	}
}